import React from 'react';
import { Form, Row, Col, Button, Input } from 'antd';

const FormItem = Form.Item;

export default ({ form, onSubmit }) => {
    const { getFieldDecorator } = form;
    const forItem = ['search_uin', 'search_remark', 'search_aegisid', 'search_operator', 'search_openid'];

    return (
        <Form layout="inline">
            <Row gutter={{ md: 24, lg: 24, xl: 48 }}>
                <Col md={8} sm={24}>
                    <FormItem label="uin">
                        {getFieldDecorator('search_uin')(<Input placeholder="请输入uin" />)}
                    </FormItem>
                </Col>
                <Col md={8} sm={24}>
                    <FormItem label="openid">
                        {getFieldDecorator('search_openid')(<Input placeholder="请输入openid" />)}
                    </FormItem>
                </Col>
                <Col md={8} sm={24}>
                    <FormItem label="备注">
                        {getFieldDecorator('search_remark')(<Input placeholder="请输入备注" />)}
                    </FormItem>
                </Col>
            </Row>
            <Row gutter={{ md: 24, lg: 24, xl: 48 }}>
                <Col md={8} sm={24}>
                    <FormItem label="操作人">
                        {getFieldDecorator('search_operator')(<Input placeholder="请输入操作人" />)}
                    </FormItem>
                </Col>
                <Col md={8} sm={24}>
                    <FormItem label="aegisid">
                        {getFieldDecorator('search_aegisid')(<Input placeholder="请输入aegisid" />)}
                    </FormItem>
                </Col>
                <Col md={8} sm={24}>
                    <Button
                        type="primary"
                        icon="search"
                        onClick={onSubmit}
                        style={{
                            float: 'right'
                        }}
                    >
                        查询
                    </Button>
                    <Button
                        onClick={() => {
                            form.resetFields(forItem);
                            onSubmit();
                        }}
                        style={{
                            float: 'right',
                            marginRight: 20
                        }}
                    >
                        重置
                    </Button>
                </Col>
            </Row>
        </Form>
    );
}